var data;
$(document).ready(function(){
    var Post ="mid="+basedata.mid+"&groupid="+basedata.groupid+"&token="+basedata.token+"&did="+commondata.myinfo+
    "&tomid="+getUrlParam("tel")+"&togroupid="+basedata.gruopid;
    $.ajax({
    	url:'../../api/account/getmemberinfobymid',
    	type:'post',
    	data:Post,
    	success:function(msg){
    		if(msg.code ==100){
    			$("#photo").attr("src",msg.datum.n1);
    			$("#name").html(msg.datum.n2);
    			$("#company").html(msg.datum.n3);
    			$("#tel").val(msg.datum.n4);
    			$("#address").val(msg.datum.n5);
    			$("#sex").val(msg.datum.n6);
    			$("#birthday").val(msg.datum.n7);
    			if(msg.datum.n6=="男"){
    				$("#chat").val("私聊他");
    			}else{
    				$("#chat").val("私聊她");
    			}
    			data=msg.datum.n1+","+msg.datum.n2+","+msg.datum.n3+","+msg.datum.n4+","+msg.datum.n5+","+msg.datum.n6+","+
    			msg.datum.n7;
    		}
    	}
    });
    $("#collect").click(function() {
		collectInfo();
	});
});
function collectInfo() {
	var Post = "mid="+basedata.mid+"&groupid="+basedata.groupid+"&token="+basedata.token+"&did="
	+commondata.myinfo+"&pid="+getUrlParam("bid")+"&collectinfo="+data;
	$.ajax({
		url:'../../api/collectforall',
		type:'post',
		data:Post,
		success:function(msg){
			if(msg.code ==100){								
				$(".coverDiv").css("display","block");
				$(".showDiv").css("display","block");
				$("#sureBtn").click(function(){
					$(".coverDiv").css("display","none");
					$(".showDiv").css("display","none");
					$("#collect").val("取消收藏");
					$(".next").css("margin-left","8%");
				});
			}
		}
	});
}
function getUrlParam(name) {
	var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
	var r = window.location.search.substr(1).match(reg);
	if (r != null) return unescape(r[2]); return null;
}